<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>全局组件与复用性</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.3.4/vue.global.js"></script> 
</head>
<body>
    <div id="app">

    </div>
</body>
<script>
    const app = Vue.createApp({
       template:`
            <website />
            <describe />
            <count />
            <count />
            <count />
       `
    })


    app.component('website',{
        template:`
        <h2>JSPang.com</h2>
        `
    })
    app.component('describe',{
        template:`
        <div>技术胖的博客</div>
        `
    })

    app.component('count',{
        data() {
            return {
                count:0
            }
        },
        template:`
           <div>
                {{count}}
                <button @click="count++">+1</button>
            </div>
        `
    })

    // 全局组件，只要定义，处处可用，性能不高，但是使用起来方便、简单
    app.mount('#app')
</script>
</html>